/*----------------------------------------------------------------------------------*/
/*!
 * @file level.hxx
 * @brief Header-File der Level Routinen
 * @author steff
 *
 */
/*------------------------------------------------------------------------------------

------------------------------------------------------------------------------------*/

#ifndef LEVEL_H_
#define LEVEL_H_

#include <time.h>

#include "main.hxx"
#include "scroll.hxx"
//#include "sdlfunc.hxx"

/* a version value of 0 (zero) indicates an invalid file header */
#define SCRO_LEVEL_INFORMATION_VERSION 1


/* 128 bytes */
struct sli_header
{
	unsigned char id[5]; 		/* 'S','L','I' for identification, 2 bytes reserved, 5 bytes */
	unsigned char version; 		/* level format version, 1 byte */
	char author[20]; 			/* level author, 20 bytes */
	char title[20]; 			/* title of level, 20 bytes */
	char tileset[20];			/* filename of tileset, 20 bytes*/
	unsigned int dim_x;			/* width in tiles, 4 bytes */
	unsigned int dim_y;			/* height in tiles, 4 bytes */
	char enemy_map[20];			/* associated enemy collection, 20 bytes */
	unsigned char reserved[30]; /* reserved bytes, 50 bytes */
};

unsigned char sli_verify_header(char *filename);
struct sli_header sli_load_header(char *filename);
unsigned char sli_generate_level(char *target_filename, unsigned int dim_x, unsigned int dim_y);
unsigned char sli_check_file(char *filename);
unsigned int * sli_load_body(char *filename/*, unsigned int *target_array*/);
Scroll_LevelType * sli_return_level(char *filename);
unsigned int sli_free_level(Scroll_LevelType * free_level);
unsigned int sli_save_level(char *filename, struct sli_header target_header, Scroll_LevelType * target_level);

#endif

